package com.zut.questionnaire.controller;

import com.zut.questionnaire.pojo.AnswerSheet;
import com.zut.questionnaire.pojo.Questionnaire;
import com.zut.questionnaire.pojo.Result;
import com.zut.questionnaire.service.AnswerSheetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("answer_sheet")
public class AnswerSheetController {

    @Autowired
    private AnswerSheetService answerSheetService;

    @GetMapping("{id}")
    public Result findById(@PathVariable String id){

        return answerSheetService.findById(id);
    }

    @PostMapping
    public Result save(@RequestBody AnswerSheet answerSheet){

        return answerSheetService.save(answerSheet);
    }

    @PutMapping("{id}")
    public Result update(@PathVariable String id,@RequestBody AnswerSheet answerSheet){

        return answerSheetService.update(id,answerSheet);
    }

    @DeleteMapping("{id}")
    public Result delete(@PathVariable String id){

        return answerSheetService.delete(id);
    }
}
